package com.shareach.http.jackson;
import java.io.IOException;

import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;

import com.shareach.util.HelperUtil;


public class JacksonIDSerializer extends JsonSerializer<Long> {
	
	@Override
	public void serialize(Long value, JsonGenerator gen, SerializerProvider arg2)
			throws IOException, JsonProcessingException {
		if(value==null || value==0){
		}else{
			gen.writeString(HelperUtil.idFromNumber(value,10));
		}
	}
}